#ifndef FAST_CRC_H_
#define FAST_CRC_H_

#include "base/base.h"

void crc32_init();
uint32 crc32(uint32 crc, const uint8 *block, uint32 leng);
uint32 crc32_combine(uint32 crc1, uint32 crc2, uint32 leng2);

#define crc32_zeroblock(crc, zeros) crc32_combine((crc) ^ 0xFFFFFFFF, 0xFFFFFFFF, (zeros))
#define crc32_zeroexpanded(crc, block, leng, zeros) crc32_zeroblock(crc32((crc), (block), (leng)), (zeros))
#define crc32_xorblocks(crc, crcblock1, crcblock2, leng) ((crcblock1) ^ (crcblock2) ^ crc32_zeroblock(crc, leng))

#endif
